<?php
namespace app\api\model;
use think\Model;

class Product extends Model
{
    protected $autoWriteTimestamp = false;
	protected $updateTime = false;
    protected $pk = 'id';
    
    // 商品单位
    public function funit() {
        return $this->hasOne('\app\api\model\Unit','id','unit_id')->bind(
            ['unit' => 'name']
        );
    }

    // 分类
    public function ftype() {
        return $this->hasOne('\app\api\model\Category', 'id', 'type_id')->bind(
            ['type' => 'name']
        );
    }
}

